package com.supplychain.scm.core.rocketmq.handler;

import com.supplychain.scm.core.rocketmq.annotation.MessageHandler;

/**
 * @author liyang
 * @version 1.0.0
 * @ClassName AbstractSupplyChainBroadcastMessageHandler
 * @Description 抽象广播消息处理
 * @createTime 11:07:00 2022/05/05
 */
public abstract class AbstractBroadcastMessageHandler<T> extends AbstractMessageHandler<T> {

    public String getTopic() {
        Class<? extends AbstractBroadcastMessageHandler> clazz = this.getClass();
        if(!clazz.isAnnotationPresent(MessageHandler.class)) {
            throw new UnsupportedOperationException();
        }
        return clazz.getAnnotation(MessageHandler.class).topic();
    }
}
